package com.example.composableexample.canvas

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material.Text
import androidx.compose.material.TextField
import androidx.compose.material.pullrefresh.rememberPullRefreshState
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.drawBehind
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp

@Preview
@Composable
fun CustomText1() {
    Column(modifier = Modifier.fillMaxSize()) {
        Text(
            text = "Android",
            color = Color.White,
            modifier = Modifier
                .background(color = Color.Gray)
                .drawBehind {
                    val borderSize = 4.dp.toPx()
                    val y = size.height - borderSize / 2
                    drawLine(
                        color = Color.Red,
                        start = Offset(x = 0f, y = y),
                        end = Offset(x = size.width / 2, y = y),
                        strokeWidth = borderSize
                    )
                }
                .padding(4.dp)
        )

        TextField(value = "Android", onValueChange = {})
    }

}